package model;

/**
 * The semaphore for the simulator.
 * @author DoubleS
 * @version 1.0
 *
 */
public class Semaphore
{
  /**
   * The value of this semaphore. Either 0 or 1.
   */
  private int my_value;
  
  /**
   * The name of this semaphore.
   */
  private String my_name;
  
  /**
   * The ID of this semaphore. This is also the index of the semaphore in the
   * memory.
   */
  private int my_id;
  
  /**
   * Construct a semaphore with the initial value.
   * @param the_value The value.
   * @param the_name The name.
   * @param the_id The ID.
   */
  public Semaphore(final int the_value, final String the_name, final int the_id)
  {
    my_value = the_value;
    my_name = the_name;
    my_id = the_id;
  }
  
  /**
   * 
   * @return The value of this semaphore.
   */
  public int getValue()
  {
    return my_value;
  }
  
  /**
   * Set the value for this semaphore.
   * @param the_value The value.
   */
  public void setValue(final int the_value)
  {
    my_value = the_value;
  }
  
  /**
   * 
   * @return The ID of this semaphore.
   */
  public int getID()
  {
    return my_id;
  }
  
  /**
   * {@inheritDoc}
   */
  public String toString()
  {
    return my_name;
  }
}
